P_ID run_number ... hems_result outcome
0 1 1 ... NaN NaN
1 1 1 ... NaN NaN
2 1 1 ... NaN NaN
3 1 1 ... NaN NaN
4 1 1 ... NaN NaN
5 1 1 ... NaN NaN
6 1 1 ... NaN NaN
7 1 1 ... NaN NaN
8 1 1 ... Patient Conveyed NaN
9 1 1 ... Patient Conveyed NaN
10 1 1 ... Patient Conveyed Conveyed by land with DAA
11 1 1 ... Patient Conveyed Conveyed by land with DAA
12 1 1 ... Patient Conveyed Conveyed by land with DAA
13 1 1 ... Patient Conveyed Conveyed by land with DAA
14 1 1 ... Patient Conveyed Conveyed by land with DAA
[15 rows x 22 columns]
df = df[df["event_type"]=="queue"]df["activity_id"] = df.groupby("run_number").cumcount() +1# Duplicate rows and modify themdf_start = df.copy()df_start["lifecycle_id"] ="start"df_end = df.copy()df_end["lifecycle_id"] ="complete"# Shift timestamps for 'end' rowsdf_end["timestamp"] = df_end["timestamp"].shift(-1)df_end["timestamp_dt"] = df_end["timestamp_dt"].shift(-1)# Combine and sortdf_combined = pd.concat([df_start, df_end]).sort_index(kind="stable")# Drop last 'end' row (since there’s no next row to get a timestamp from)df_combined = df_combined[:-1]df_combined.to_csv("event_log.csv", index=False)df_combined
Warning: There was 1 warning in `mutate()`.
ℹ In argument: `timestamp_dt = (function (..., quiet = FALSE, tz = "UTC",
locale = Sys.getlocale("LC_TIME"), ...`.
Caused by warning:
! 72 failed to parse.
## !!!! Note that the bupaR documentation recommmends using the## to_activitylog() function at the end of this set of steps.## This caused significant errors in testing of this codeactivity_log
Warning in process_map.eventlog(., frequency("absolute")): Some of the
timestamps in the supplied event log are missing (NA values). This may result
in a invalid process map!
Warning in process_map.eventlog(., frequency("absolute-case")): Some of the
timestamps in the supplied event log are missing (NA values). This may result
in a invalid process map!
Warning in process_map.eventlog(., frequency("relative")): Some of the
timestamps in the supplied event log are missing (NA values). This may result
in a invalid process map!
activity_log %>%process_map(performance())
Warning in process_map.eventlog(., performance()): Some of the timestamps in
the supplied event log are missing (NA values). This may result in a invalid
process map!
Warning in process_map.eventlog(., performance(FUN = max)): Some of the
timestamps in the supplied event log are missing (NA values). This may result
in a invalid process map!
Warning: There were 10 warnings in `summarize()`.
The first warning was:
ℹ In argument: `value = do.call(...)`.
ℹ In group 1: `ACTIVITY_CLASSIFIER_ = "ARTIFICIAL_END"`, `next_act =
"ARTIFICIAL_START"`, `from_id = 1`, `to_id = 2`.
Caused by warning in `type()`:
! no non-missing arguments to max; returning -Inf
ℹ Run `dplyr::last_dplyr_warnings()` to see the 9 remaining warnings.
activity_log %>%trace_explorer(n_traces =10)
activity_log %>%activity_presence() %>%plot()
activity_log %>%processing_time("resource-activity", units ="mins") %>%plot()
activity_log %>%idle_time("resource", units ="mins") %>%plot()
Animated Maps
activity_log %>%animate_process()
Warning in process_map.eventlog(eventlog, render = F, ...): Some of the
timestamps in the supplied event log are missing (NA values). This may result
in a invalid process map!
Warning: There was 1 warning in `mutate()`.
ℹ In argument: `timestamp_dt = (function (..., quiet = FALSE, tz = "UTC",
locale = Sys.getlocale("LC_TIME"), ...`.
Caused by warning:
! 72 failed to parse.
activity_log_2 %>%animate_process()
Warning in process_map.eventlog(eventlog, render = F, ...): Some of the
timestamps in the supplied event log are missing (NA values). This may result
in a invalid process map!